/**
 * @Description:
 * @author 紫霞
 * @since 2019/1/17
 */
// React基础组件
import React from 'react'
// dva 连接组件 - 连接route和model
import { connect } from 'dva'
// 引入antd的组件
import {
    Form,
    Row,
    Col,
    Input,
    Cascader,
    Tag,
    Icon,
    DatePicker,
    Select,
    Button,
    Upload,
    Modal,
    Divider,
    Tooltip,
    message,
    Radio, 
    Checkbox,
} from 'antd'
//导入路由组件，用于跳转等
import { Link, hashHistory } from 'dva/router'
// 导入项目全局配置文件
import config from 'config/config'
import { isEmpty, isArray, cloneDeep, chunk } from 'lodash'

// 引入model取值工具方法
import { mapStateToProps } from 'utils/view_utils'
import { reg } from 'utils/util'
// 当前组件样式
import styles from './productEditStyle.less'
import ListPage from 'widget/PageTmpl/ListPage'

import { CollapsiblePanels } from 'widget/CollapsiblePanels/index'

import Uploader from "../../../../widget/Upload";
import classnames from 'classnames/bind'
import Ueditor from "../../../../widget/Editor/Ueditor.js";
import moment from 'moment/moment'
import { number } from 'prop-types'

let cx = classnames.bind(styles);
let t1 = moment()

const FormItem = Form.Item
const { TextArea } = Input
const InputGroup = Input.Group;
const RadioGroup = Radio.Group;
const formItemLayout = {
  labelCol: { span: 8 },
  wrapperCol: { span: 15 },
}
const formItemLayout2 = {
  labelCol: { span: 11 },
  wrapperCol: { span: 13 },
}
const formItemLayout1 = {
  labelCol: { span: 7 },
  wrapperCol: { span: 17 },
}
const imageLayout = {
  labelCol: { span: 2 },
  wrapperCol: { span: 22 },
}
const tagLayout = {
  labelCol: { span: 4 },
  wrapperCol: { span: 15 },
}

const projectLayout = {
  labelCol: { span: 4 },
  wrapperCol: { span: 19 },
}
/**
 * description 路由视图及事件处理
 * dispatch 分发到models中的effects对应事件名
 * model 用于获取models中state定义的数据
 * form 表单对象
 */

let productTypeMap={//商品类型
  1:'房源',
  2:'停车位',
  3:'商铺',
  4:'日用快消',
  5:'家电数码',
  6:'首饰箱包',
  7:'其他',
}
let propertyTypeMap={//物业类型
  11:'住宅',
  12:'公寓',
  21:'地上车位',
  22:'地下车位（非人防车位）',
  23:'地下车位（人防车位）',
  24:'地下车库',
  25:'地上车库',
  31:'地上商铺',
  32:'地下商铺',
  33:'地上集中商业',
  34:'地下集中商业',
}
let goodsType=[
  { value: '1', label: '房源' },
  { value: '2', label: '停车场' },
  { value: '3', label: '商铺' },
  { value: '4', label: '日用快消' },
  { value: '5', label: '家电数码' },
  { value: '6', label: '首饰箱包' },
  { value: '7', label: '其他' },
]
let productTypeLabelMap = { 1: '详细房号', 2: '车位位置', 3: '商铺位置',4:'商品名称',5:'商品名称',6:'商品名称',7:'商品名称'}
// 项目编号 项目名称 类型 详情  活动名称 状态 备注  创建人 创建时间
const columns = [
  {
    title: '项目编号', dataIndex: 'key', key: 'key', width: 100,
    render: function (value, item, index) {
      return index + 1
    }
  },
  {title: '项目名称', dataIndex: 'name', key: 'name', width: 200,},
  {
    title: '类型', dataIndex: 'propertyType', key: 'propertyType', width: 200,
    render: function (value, item, index) {
      return propertyTypeMap[value]
    }
  },
  {title: '详情', dataIndex: 'detail', key: 'detail',},
  {title: '活动名称', dataIndex: 'activeName', key: 'activeName', width: 200,},
  {
    title: '状态', dataIndex: 'status', key: 'status', width: 80,
    render: function (value, item, index) {
      return {1: '未上架', 2: '已上架', 3: '未售出', 4: '已售出', 5: '已失效'}[value]
    }
  },
  // {title: '备注', dataIndex: 'remark', key: 'remark',},
  {title: '创建人', dataIndex: 'createPerson', key: 'createPerson', width: 100,},
  {title: '创建时间', dataIndex: 'createTime', key: 'createTime', width: 200,},
]
// 房源 :住宅 公寓
// 停车位 ：地上车位  地下车位（非人防车位） 地下车位（人防车位） 地下车库  地上车库
// 商铺 ：地上商铺  地下商铺  地上集中商业  地下集中商业
const proList = [
  {
    id: '1',
    name: '房源',
    list: [
      {
        id: '11',
        name: '住宅',
      },
      {
        id: '12',
        name: '公寓',
      },
    ],
  },
  {
    id: '2',
    name: '停车位',
    list: [
      {
        id: '21',
        name: '地上车位',
      },
      {
        id: '22',
        name: '地下车位（非人防车位）',
      },
      {
        id: '23',
        name: '地下车位（人防车位）',
      },
      {
        id: '24',
        name: '地下车库',
      },
      {
        id: '25',
        name: '地上车库',
      },
    ],
  },
  {
    id: '3',
    name: '商铺',
    list: [
      {
        id: '31',
        name: '地上商铺',
      },
      {
        id: '32',
        name: '地下商铺',
      },
      {
        id: '33',
        name: '地上集中商业',
      },
      {
        id: '34',
        name: '地下集中商业',
      },
    ],
  },
  {
    id: '4',
    name: '日用快消',
    list: [
    ],
  },
  {
    id: '5',
    name: '家电数码',
    list: [
    ],
  },
  {
    id: '6',
    name: '首饰箱包',
    list: [
    ],
  },
  {
    id: '7',
    name: '其他',
    list: [
    ],
  },
]



const routeView = function ({ dispatch, model, form }) {
  // 表单的子函数
  const { resetFields, getFieldDecorator, validateFields, setFieldsValue } = form
  // 取出model对象，命名空间
  const { modelObj, namespace } = model
  let { pageType, id, modalObj, imageUrls, tags, tagsList, tagInputValue, tagInputVisible, formData, detailInfo, fileList, houseList, allAddress, houseTypeList ,accountList,loading,freeSecurityMoney,selectOption,teamsOptions,standards,medias,show,biz,biz1,area1,products, areaList,accountTyp,payCodeList,isAll} = modelObj
  // modelObj.xxx获取model中状态机的值
 
  // console.log('routeView', modelObj)
  let pageProps = {
    // ---------- 界面部分 ----------
    "ui": {
      // 页面接口地址
      "api_url": "admin/seckill/queryProductList",
      // 接口方式
      "method": "POST",
      "app": "",
      // 接口参数
      "params": `sellType=${modelObj.sellType}&status=5&pageNo=1&pageSize=10`,
      // "params": ``sellType=${modelObj.sellType}&status=5&pageNo=1&pageSize=10`,
      // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
      // "mockData": mockData,
      "mockData": null,
      // 查询栏
      "search_bar": {
        "fields": [
          {
            en_name: 'projectName',
            zh_name: '项目名称',
            elem_type: 'Input',
            elem_valid_type: 'string',
          },
          {
            en_name: 'type',
            zh_name: '商品类型',
            elem_type: 'Select',
            cmpt_items:goodsType,
            elem_valid_type: 'string',
          },
        ],
      },
      // 数据表格
      "table":
        {
          "status_params": "status=0",
          "status_text": "全部",
          // 表头字段列表
          "scroll": { x: 900 },
          "fields": [
            {
              "en_name": "name",
              "zh_name": "项目名称",
              width:150,
            },
            {
              "en_name": "productType",
              "zh_name": "类型",
              width:100,
              render: function (value, item, index) {
                return productTypeMap[value]
              }
            },
            {
              "en_name": "detail",
              "zh_name": "详情",
              width:200,
            },
            {
              "en_name": "status",
              "zh_name": "状态",
              width:90,
              render: function (value, item, index) {
                return {1: '未上架', 2: '已上架', 3: '未售出', 4: '已售出', 5: '已失效'}[value]
              }
            },
            {
              "en_name": "createPerson",
              "zh_name": "创建人",
              width:100,
            },
            {
              "en_name": "createTime",
              "zh_name": "创建时间",
              width:180,
            },
            {
              "en_name": "edit",
              "zh_name": "操作",
              render: (a, item, index, d, e, f) => {
                return (
                  <span>
                  <a onClick={() => routerGo({type: 'edit', item: {...item,isClone:true}})}>引用</a>
                </span>
                )
              },
            }
          ]
        },
    },
  }
  let pageProps1 = {
    // ---------- 界面部分 ----------
    "ui": {
      // 页面接口地址
      "api_url": "admin/goods/list",
      // 接口方式
      "method": "POST",
      "app": "",
      // 接口参数
      "params":{},
      // "params": ``sellType=${modelObj.sellType}&status=5&pageNo=1&pageSize=10`,
      // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
      // "mockData": mockData,
      "mockData": null,
      // 查询栏
      "search_bar": {
        "fields": [
          {
            en_name: 'parentProductName',
            zh_name: '项目名称',
            elem_type: 'Input',
            elem_valid_type: 'string',
          },
          {
            en_name: 'catalogId',
            zh_name: '商品类型',
            elem_type: 'Select',
            elem_valid_type: 'string',
            cmpt_items: [
              {
                value: '',
                label: '全部'
              },
              {
                value: '9004',
                label: '日用快消'
              },
              {
                value: '9005',
                label: '家电数码'
              },
              {
                value: '9006',
                label: '首饰箱包'
              },
              {
                value: '9009',
                label: '其他'
              }
            ]
          },
        ],
      },
      // 数据表格
      "table":
          {
            "status_params": "status=0",
            "status_text": "全部",
            // 表头字段列表
            "scroll": { x: 1000 },
            "fields": [
              // {
              //   "en_name": "serialNumber",
              //   "zh_name": "活动编号编号",
              // },
              {
                "en_name": "productId",
                "zh_name": "商品编码",
                width: 130,
              },
              {
                "en_name": "pic",
                "zh_name": "商品图片",
                render:(text,item,index)=>{
                  if(text){
                    return <img style={{'width':'80px'}} src={text} alt=""/>
                  }
                },
               
              },
              {
                "en_name": "parentProductName",
                "zh_name": "所属项目",
                width: 100,
              },
              {
                "en_name": "name",
                "zh_name": "商品名称",
                width:130,             
               },
              {
                "en_name": "cityName",
                "zh_name": "规格",
                width:120,
                render: (text, item, index) => {
                  for(let i in teamsOptions){
                    if(item[teamsOptions[i].value]){
                      return <span>{teamsOptions[i].label}:{item[teamsOptions[i].value]}</span>
                    }
                  }
                }

              },
              {
                "en_name": "catalogId",
                "zh_name": "商品类型",
                width:90,
                render: (text, item, index) => {
                  if (text == '9004') {
                    return <span>日用快消</span>
                  }else if(text == '9005'){
                    return <span>家电数码</span>
                  }else if (text == '9006') {
                    return <span>首饰箱包</span>
                  }else{
                    return <span>其他</span>
                  }
                }
              },
              {
                "en_name": "createPerson",
                "zh_name": "创建人",
                width:80,
              },
              {
                "en_name": "createTime",
                "zh_name": "创建时间",
                width:180,
              },
              {
                "en_name": "edit",
                "zh_name": "操作",
                render: (a, item, index, d, e, f) => {
                  return (
                      <span>
                  <a onClick={() => routerGo({type: 'edit', item: {...item,isClone:true},detailType:'good'})}>引用</a>
                </span>
                  )
                },
              }
            ],
          },
    },
  }
  let pageProps2 = {   //楼盘
    // ---------- 界面部分 ----------
    ui: {
      // 页面接口地址
      api_url: 'admin/estate/adminList',
      // 接口方式
      method: 'POST',
      headers: {
        'Content-type': 'application/json'
      },
      app: '',
      // 接口参数
      params:biz.queryForm,
      // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
      // "mockData": mockData,
      mockData: null,
      isAll:isAll,//新增选择全部选项，数据 在返回的时候自行处理
      selectedRowKeys:biz.selectedRowKeys,
      // 查询栏
      search_bar: {
        fields: [
          {
            en_name: 'province',
            zh_name: '城市',
            elem_type: 'Cascader',
            elem_valid_type: 'string',
            changeOnSelect: true,
            cmpt_items: allAddress,
            split_keys: ['province', 'city'],
          },
          {
            en_name: 'name',
            zh_name: '项目名称',
            elem_type: 'Input',
            elem_valid_type: 'string',
          },
          // {
          //   en_name: 'shelfStatus',
          //   zh_name: '状态',
          //   elem_type: 'Select',
          //   cmpt_items: [
          //     {value: null, label: '全部'},
          //     {value: '0', label: '未上架'},
          //     {value: '1', label: '已上架'},
          //     {value: '2', label: '已下架'},
          //   ],
          //   elem_valid_type: 'string',
          // },
        ],
        searchHandler: (e) => { // 自定义搜索按钮回调函数，点击搜索时触发
          console.log('search click', e)
        },
        resetHandler: () => { // 自定义重置按钮回调函数，点击重置时触发
          console.log('reset click')
        },
        searchCallback: params => { // 自定义搜索完成后的后调函数, 搜索完成后触发, 并将本次搜索的参数传入
          console.log('search finish', params)
        },
        pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
          'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
        ]
      },
      // 数据表格
      'table':
        {
          rowSelectionInfo: {
            type: 'radio',
          },
          key: 'productId',
          status_params: 'status=0',
          status_text: '全部',
          // 表头字段列表
          scroll: {x: 800},
          fields: [
            {
              en_name: 'estateCode',
              zh_name: '项目编号',
              // width: 150,
            },
            {
              en_name: 'name',
              zh_name: '项目名称',
              // width: 100,
            },
            {
              en_name: 'cityName',
              zh_name: '所属城市',
              width:150,
              // width: 100,
              render: (a, item, index, d, e, f) => {
                let arr = ['北京市', '重庆', '上海', '天津']
                if (arr.indexOf(item.provinceName) > -1) {
                  return item.cityName
                } else {
                  return `${item.provinceName||''}${item.provinceName&&item.cityName&&' - '||''}${item.cityName||''}`
                }
                
              }
            },
            {
              en_name: 'shelfStatus',
              zh_name: '状态',
              width: 80,
              render: (a, item, index, d, e, f) => {
                let shelfStatus = ['未上架', '已上架', '已下架']
                return (
                  <span>{shelfStatus[item.shelfStatus]}</span>
                )
              }
            },
            {
              en_name: 'createPerson',
              zh_name: '创建人',
              // width: 100,
            },
            {
              en_name: 'createTime',
              zh_name: '创建时间',
              width: 180
            },
          ],
          // 表格操作
          actions: [],
        },
      action_bar: [
        {
          // label:'',
          // type:'',
          rowSelection: [],
          render: () => {
            return <Input hidden/>
          },
          onClick: (e, row) => {
          }
        },
      ]
    },
  }
  let pageProps3 = {
    // ---------- 界面部分 ----------
    ui: {
      // 页面接口地址
      api_url: "admin/bankAccount/queryList",
      // 接口方式
      method: "POST",
      headers: {
        "Content-type": "application/json"
      },
      app: "",
      // 接口参数
      params: biz1.queryForm,
      // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
      // "mockData": mockData,
      mockData: null,
      selectedRowKeys:biz1.selectedRowKeys,
      // 查询栏
      search_bar: {
        fields: [
          {
            en_name: 'regionId',
            zh_name: '所属区域',
            elem_type: 'Select',
            elem_valid_type: 'string',
            	//关联的更改的搜索字段
            cmpt_items:area1,
         },
         {
          en_name: 'province',
          zh_name: '所属城市',
          elem_type: 'Cascader',
          elem_valid_type: 'string',
          changeOnSelect:true,
          cmpt_items: areaList,
          split_keys: ['provinceCode', 'cityCode'],
          onFocus:()=>{
            area1.map((item,index)=>{
              console.log(biz1.queryForm.regionId,item.value)
              if(biz1.queryForm && biz1.queryForm.regionId && biz1.queryForm.regionId==item.value)
              {
                console.log(biz1.queryForm.regionId,item.value)
                dispatch({
                  type: `${namespace}/updateStore`,
                  payload:{
                    areaList:item.children,
                  }
                })
              }
            })
          },
        },
         {
            en_name: 'productId',
            zh_name: '项目名称',
            elem_type: 'Select',
            elem_valid_type: 'string',
            // showSearch:true,
            cmpt_items:products,
            onFocus:()=>{
              if(biz1.queryForm && biz1.queryForm.cityCode && biz1.queryForm.cityCode)
              {
                dispatch({
                  type: `${namespace}/getProduct`,
                  payload:{
                    cityCode:biz1.queryForm.cityCode,
                  }
                })
              }
            },
          },
          {
            en_name: 'accountName',
            zh_name: '账户名称',
            elem_type: 'Input',
            elem_valid_type: 'string',
          },
          
        ],
        searchHandler: (e) => { // 自定义搜索按钮回调函数，点击搜索时触发
          console.log('search click',e)
        },
        resetHandler: () => { // 自定义重置按钮回调函数，点击重置时触发
          console.log('reset click')
        },
        searchCallback: params => { // 自定义搜索完成后的后调函数, 搜索完成后触发, 并将本次搜索的参数传入
          console.log('search finish', params)
        },
        pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
          'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
        ]
      },
      // 数据表格
      "table":
        {
          rowSelectionInfo: {
            type: 'radio',
          },
          key: 'productBankAccountId',
          status_params: 'status=0',
          status_text: '全部',
          // 表头字段列表
          // 表头字段列表
          scroll: { x: 1000 },
          fields: [
            {
              en_name: "name",
              zh_name: "项目名称",
            },
            {
              en_name: "cityName",
              zh_name: "所属城市",
              width:135,
              render:(a, item, index, d, e, f) => {
                return `${item.provinceName||''}${item.provinceName&&item.cityName&&' - '||' '}${item.cityName||''}`
              }
            },
            {
              en_name: "accountName",
              zh_name: "账户名称",
              width:130,
            },
            {
              en_name: "bankAccount",
              zh_name: "银行账号",
            },
            {
              en_name: 'accountType',
              zh_name: '账户类型',
              width:70,
              render: () => {
                return '公户'
              }
            },
            {
              en_name: "bankAccountName",
              zh_name: "开户支行",
              width:120,
            },
            {
              en_name: "createPerson",
              zh_name: "创建人",
              width:80
            },
            {
              en_name: "createTime",
              zh_name: "创建时间",
              width:180,
            },
          ]
        },
        action_bar: [
          {
            // label:'',
            // type:'',
            width:60,
            rowSelection: [],
            render: () => {
              return <Input hidden/>
            },
            onClick: (e, row) => {
            }
          },
        ]
    },
  }
  // 详情页跳转
  function routerGo ({type='', item = {},detailType=''}) {
    let urlArray = MODULE_TO_ROUTES[namespace].urlArray
    hashHistory.push({
      pathname: urlArray[0],
      query: {pageType: type, id: item.seckillProductId || item.productId || '',isClone:item.isClone,detailType}
    })
    resetFields()//重置所有组件
  }
  //获取物业类型（物业类型与商品类型联动）
  function getPropertyTypeList() {
    let list = cloneDeep(proList)
    let arr = []
    list.map((item, index) => {
      if (item.id === formData.productType + '') {
        arr = item.list
      }
    })
    return arr
  }


  // 重置表单
  const onCancel = () => {
    form.resetFields()
    formData = cloneDeep(detailInfo)
    imageUrls = cloneDeep(detailInfo.imageUrls)
    tags = cloneDeep(detailInfo.tags)
    // 分发到model
    changeState({ formData, showBack: false, showButton: true })
  }
  //修改状态
  const changeState = (payload) => {
    dispatch({
      type: `${namespace}/updateStore`,
      payload: { ...payload }
    })
  }

  // 新
  // 弹窗
  function inputChange (value, key, index) {

    if (key == 'productType') {
      formData.productLabel = productTypeLabelMap[value] || null
      formData['productType']=value
      if(Number(value)<4==true&&formData.projectId==='0'){
        formData.projectId = '',
        formData.projectName = ''
      }
      changeState({isAll:Number(value)>3})
    }
    else if (key == 'areaId') {
      formData.province = value[0]
      formData.city = value[1]
      formData.projectId = ''
      formData.projectName = ''
      setFieldsValue({'projectId':''})
      dispatch({type: `${namespace}/houseListGet`, payload: {province: value[0], city: value[1]}})
    }
    else if (key.indexOf('houseTypeName') > -1) {
      key = key.split('_')
      formData.houseTypeName[key[1]] = value
    }
    else if (key == 'projectId') {
      formData[key] = value
      houseList.map((item,index)=>{//项目名称
        if(item.value==value){
          formData['projectName']=item.label
        }
      })
      form.resetFields(`productBankAccountId`,'');
      form.resetFields(`bankAccount`,'');
      formData.productBankAccountId=''
      formData.bankAccount=''
      updateModal('project')
      setFieldsValue({'projectId':value})
      dispatch({type: `${namespace}/queryAccount`, payload: {id: value,}})
    }  else if (key === 'enrollType') {
        formData[key] = value
        if(value) { // 免交
            formData.securityMoney = ''
            // 表单清空
            form.resetFields(`securityMoney`,[]);
        }
    }else if(key==='productBankAccountId'){
      formData[key] = value
      accountList.map((item,index)=>{
        if(value===item.productBankAccountId){
          formData.bankAccount=accountList[index].bankAccount      
         }
      })
      
    }else if(key=='merchantCode'){
      console.log(value)
      let items = payCodeList.filter(item=> item.merchantCode == value)
      formData[key] = items[0].merchantCode
      formData.payWay = items[0].type
    }
    else {
      formData[key] = value
    }
    changeState({formData})

  }

  //校验
  function validator(rule, value, callback, type = '') {
    console.warn('validator :rule, value, callback, type', rule, value, type);
    //报名费、报名费只能小于等于定金
    // if (rule.field == 'securityMoney') {
    //   if ((formData.earnestMoney) && (!(Number(value) < Number(formData.securityMoney)))) {
    //     callback('报名费只能小于定金')
    //     return
    //   }
    // }
    // else if (rule.field == 'earnestMoney') {//定金
    //   if ((formData.securityMoney ) && (!(Number(value) > Number(formData.securityMoney)))) {
    //     callback('定金只能大于报名费')
    //     return
    //   }
    // }
    if (value && (isNaN(value) || !/^\d+(\.\d{1,2})?$/.test(value))) {
      callback('请输入数字（最多两位）')
    }
    else if (value > 999999999.99 || value < 0) {
      callback('数字范围在0-99999999.99之间')
    }
    else {
      callback()
    }
  }

  // updateProduct createProduct
  function save() {
    let methodName={ edit: 'update', add: 'create', detail: '' }[pageType]
    if(modelObj.isClone){//clone方式新建
      methodName='create'
    }
    validateFields((err) => {
      if (err) {
        for(var i in err){
            message.error(err[i].errors[0].message)
            return
        }
        
      } else {
        dispatch({
          type: `${namespace}/${methodName}`,
          payload: {resetFields}
        })
      }
    })
  }

  // 筛选项目名称下拉列表
  function filter(inputValue, path) {
    return (path.some(option => (option.label).toLowerCase().indexOf(inputValue.toLowerCase()) > -1))
  }
  

  function updateImageModel(value) {
    imageUrls.push(value);
    // 分发到model
    dispatch({
      type: `${namespace}/updateStore`,
      payload: { imageUrls }
    })
  };

  function removeImgUrl(index) {
    imageUrls.splice(index, 1)
    dispatch({
      type: `${namespace}/updateStore`,
      payload: { imageUrls }
    })
  }
  function updateModal (modalName) {
    // console.log(formData)
    if(formData.productType==''){
      message.error('请先选择商品类型！')
      return false
    }
    modalObj[modalName].visible=!modalObj[modalName].visible
    changeState({modalObj})
    // if(modalName=='project'){
    //   dispatch({
    //     type:`${namespace}/houseListGet`,
    //     payload:{}
    //   })
    // }
  }

  // function normalize (e) {
  //   if (!isNaN(e)) {
  //     console.log(e);
  //     let reg = /([0-9]+\.[0-9]{2})[0-9]*/;
  //     if (reg.test(e)) {
  //       let reg = /([0-9]+\.[0-9]{2})[0-9]*/;
  //       let aNew = (e&&(e+'')||'').replace(reg, "$1");
  //       return aNew;
  //     } else {
  //       return e;
  //     }
  //   }
  // }
  // -----------标签--结束--------
  function confirm(){
    form.resetFields("projectId");
    modalObj.project.visible=false;
    formData.projectId = biz.selectedRows[0].productId;
    formData.projectName=biz.selectedRows[0].name;
    dispatch({
        type:`${namespace}/updateStore`,
        payload:{
            formData:formData,
            modalObj
        }
    })
}
function confirm1(){
  modalObj.accountList.visible=false
  console.log(biz1)
  dispatch({
      type:`${namespace}/updateStore`,
      payload:{
          formData:{
              ...formData,
              productBankAccountId:biz1.selectedRows[0].productBankAccountId ,
              accountName:biz1.selectedRows[0].accountName,
              bankAccount:biz1.selectedRows[0].bankAccount,
              modalObj,
          }
      }
  })
}

if (!!modelObj.biz) {
    pageProps2.biz = modelObj.biz
    pageProps2.biz.syncBackCbf = (biz) => {
      let productObj = {
        productId:'0',
        name:'全部',
        key:'0'
      }
      biz.selectedRowKeys=pageProps2.biz.selectedRowKeys
      if(isAll){
        biz.tableData.dataSource.unshift(productObj)
      }
      console.log(biz)
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { biz }
      })
    }
  }
  if (!!modelObj.biz1) {
    pageProps3.biz = modelObj.biz1
    pageProps3.biz.syncBackCbf = (biz) => {
      console.log(pageProps3.biz)
      biz.selectedRowKeys=pageProps3.biz.selectedRowKeys
      biz.selectedRows=pageProps3.biz.selectedRows
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { biz1:biz }
      })
    }
  }
  return (
    <div className={cx('public_listMain')}>
      <div className="functionButton">
        {!((pageType=='edit')&&(!modelObj.isClone))&&
        <Button type='primary' onClick={()=>{ updateModal('productList')}}>引用已失效商品信息</Button>
        }
        {!((pageType=='edit')&&(!modelObj.isClone))&&
        <Button type='primary' onClick={()=>{ updateModal('productList1')}}>引用非房产类型商品信息</Button>
        }
        <Button type='primary' loading={modelObj.btnLoading} onClick={() => { save() }}>保存</Button>
        {/*<Button type='primary' onClick={() => { }}>导出模板</Button>*/}
      </div>

      <CollapsiblePanels title="商品信息" hideUpDownBtn={true}>
        <div className={''}>
          <Row>

          <Col className="col" span={8}>
              <FormItem {...formItemLayout1}
                        label="商品类型">
                {getFieldDecorator('productType', {
                  initialValue: productTypeMap[formData.productType],
                  rules: [
                    { required: true,  message: '请选择商品类型' },
                  ],
                })((<Select disabled={pageType == 'detail' || show } placeholder="请选择"
                            onChange={(val) => inputChange(val, 'productType')}>
                  {
                    proList.map((item, index) => {
                      return (
                        <Select.Option key={index} value={item.id}>{item.name}</Select.Option>
                      )
            
                    })
                  }
                </Select>))}
              </FormItem>
            </Col>
            <Col className="col" span={8}>
              <FormItem {...formItemLayout1} label={'所属项目'}>
                {getFieldDecorator('projectId', {
                  initialValue: formData.projectId,
                  rules: [
                    { required: true,  message: '请选择所属项目' },
                  ],
                })(
                  <div>
                  {/* {console.log(t1,formData.startTime)} */}
                <text>{'0'===formData.projectId?'全部':formData.projectName||formData.parentProductName ||''}</text>
                    {
                       show?null:<a href="javascript:void(0)" onClick={()=>{updateModal('project')}} className={'mgl1'}>{'选择'}</a>
                    }
                    
                  </div>
                )}
              </FormItem>
            </Col>
            <Col className="col" span={8}>
              <FormItem {...formItemLayout1}
                        label={
                          `${formData.productLabel ? formData.productLabel : '详细房号'}`
                        }>
                {getFieldDecorator('detail', {
                  initialValue: formData.detail || formData.name,
                  rules: [
                    { required: true,  message: `请输入${formData.productLabel ? formData.productLabel.slice(0, 4) : '详细房号'}` },
                  ],
                })(<Input
                  disabled={pageType == 'detail' || show}
                  placeholder={`请输入${formData.productLabel ? formData.productLabel.slice(0, 4) : '详细房号'}`}
                  onChange={(e) => { inputChange(e.target.value, 'detail') }}
                />)}
              </FormItem>
            </Col>
          </Row>
          <Row>
            {(formData.productType == ''|| formData.productType == 1 || formData.productType == 2||formData.productType == 3)&&
            <Col className="col" span={8}>
              <FormItem {...formItemLayout1}
                        label="面积">
                {getFieldDecorator('area', {
                  initialValue: formData.area,
                  rules: [
                    { required: true,  message: '请输入面积' },
                    // { pattern: regMap.num,  message: '请输入数字' },
                  ],
                  // normalize: normalize
                })(<Input
                    disabled={pageType == 'detail' || show }
                    placeholder={'请输入面积'}
                    addonAfter="㎡"
                    onChange={(e) => { inputChange(e.target.value, 'area') }}
                />)}
              </FormItem>
            </Col>

            }
            {(formData.productType == ''|| formData.productType == 1 || formData.productType == 2||formData.productType == 3)&&
            <Col className="col" span={8}>
              <FormItem {...formItemLayout1}
                        label="物业类型">
                {getFieldDecorator('propertyType', {
                  initialValue: propertyTypeMap[formData.propertyType],
                  rules: [
                    { required: true,  message: '请选择物业类型' },
                  ],
                })((<Select disabled={pageType == 'detail' || show} placeholder="请选择"
                            onChange={(val) => inputChange(val, 'propertyType')}>
                  {
                    (getPropertyTypeList()).map((item, index) => {
                      return (
                          <Select.Option key={index} value={item.id}>{item.name}</Select.Option>
                      )
                    })
                  }
                </Select>))}
              </FormItem>
            </Col>
            }
            {(formData.productType == 1)&&
              <Col className="col" span={8}>
                <FormItem {...formItemLayout1} label="户型" className={cx('flex')}>
                  {getFieldDecorator('houseTypeName', {
                    initialValue: formData.houseTypeName,
                    rules: [
                      { required: (formData.productType == 1)?true:false,  message: '请输入户型',type: 'array' },
                      { validator: (rule, value, callback) => {
                          ((value || value + '' === '0') && ('' + value).search(/^(0|[1-9]\d{0,9})$/)) ? callback('限制为10位以内的整数') : callback();
                        } },
                    ],
                  })(
                    <InputGroup compact >
                      <Input
                        style={{width:'33.3%'}}
                        addonAfter="室"
                        disabled={pageType == 'detail'|| formData.productType != 1 || show}
                        value={(formData.productType == 1)?formData.houseTypeName[0]:''}
                        onChange={(e) => { inputChange(e.target.value, 'houseTypeName_0') }}
                      />
                      <Input
                        style={{width:'33.3%'}}
                        addonAfter="厅"
                        disabled={pageType == 'detail'||formData.productType != 1 || show}
                        value={(formData.productType == 1)?formData.houseTypeName[1]:''}
                        onChange={(e) => { inputChange(e.target.value, 'houseTypeName_1') }}
                      />
                      <Input
                        style={{width:'33.3%'}}
                        addonAfter="卫"
                        disabled={pageType == 'detail'||formData.productType != 1 || show}
                        value={(formData.productType == 1)?formData.houseTypeName[2]:''}
                        onChange={(e) => { inputChange(e.target.value, 'houseTypeName_2') }}
                      />
                    </InputGroup>
                  )}
                </FormItem>
              </Col>
            }
            {(formData.productType == 4 || formData.productType == 5 || formData.productType == 6 || formData.productType == 7)&&
            <Col span={8}>
              <FormItem {...formItemLayout1}
                        label="规格">
                <InputGroup compact>
                  <Select
                      onChange={value=>{
                        
                        selectOption.value = value
                        changeState({selectOption})

                      }}
                      disabled={show}
                      value={selectOption.value} style={{width:'30%'}}>
                    {teamsOptions.map((option, idx)=>(
                        <Select.Option
                            key={`option${idx}`} value={option.value}>{option.label} </Select.Option>
                    ))}

                  </Select>
                  <Input
                      style={{width:'70%'}}
                      value={selectOption.des}
                      disabled={show}
                      onChange={(e)=>{

                        selectOption.des = e.target.value
                        changeState({selectOption})

                      }}
                  />
                </InputGroup>
                {/*<Button type="dashed"  style={{ width: '48%'}}>*/}
                  {/*<Icon type="plus" />增加规格</Button>*/}
              </FormItem>

            </Col>
            }
             {(formData.productType == 4 || formData.productType == 5 || formData.productType == 6 || formData.productType == 7)&&
            <Col  className="col" span={8}>
              <FormItem {...formItemLayout1}
                        label="数量">
                {getFieldDecorator(`stock`, {
                  initialValue:  formData.stock,
                  rules: [
                    { required: true, whitespace: true, type:'number',
                    transform(value) {
                      if(value){
                        return Number(value);
                      }
                    }, message: '请输入数字' },
                  ],
                })((<Input
                    disabled={show}
                    placeholder="请输入商品数量"
                    // autosize={{ minRows: 2, maxRows: 3 }}
                    onChange={(e) => { inputChange(e.target.value, 'stock') }}
                />))
                }
              </FormItem>
            </Col>
            }
            
            {formData.productType > 3 &&(
              <span>
                <Col span={6}>
                  <FormItem {...formItemLayout2} label="是否显示库存">
                        
                        {getFieldDecorator('showStockFlag', {
                          initialValue: formData.showStockFlag,
                          rules: [
                            { required: true, whitespace: true, message: '请选择是否显示库存', type:"number"},
                          ],
                        })(
                          <Radio.Group onChange={(e) => inputChange(e.target.value, 'showStockFlag')}>
                            <Radio value={1}>是</Radio>
                            <Radio value={0}>否</Radio>
                          </Radio.Group>
                        )}
                  </FormItem>
                </Col>
                <Col  className="col" span={8}>
                  <FormItem {...formItemLayout1}
                              label="商品描述">
                      {getFieldDecorator(`promotionDetail`, {
                        initialValue:  formData.promotionDetail,
                        rules: [
                          { required: false, whitespace: true, message: '' },
                        ],
                      })((<TextArea
                          placeholder="请输入商品描述"
                          disabled={show}
                          // autosize={{ minRows: 2, maxRows: 3 }}
                          onChange={(e) => { inputChange(e.target.value, 'promotionDetail') }}
                      />))
                      }
                  </FormItem>
                </Col>
              </span>
              
            
            )
            
            }
          </Row>
          <Row>
            {(formData.productType == 1)&&
              <Col className="col" span={8}>
                <FormItem {...formItemLayout1}
                          label="户型朝向">
                  {getFieldDecorator('orientation', {
                    initialValue:(formData.productType == 1)?formData.orientation:'',
                    rules: [
                      { required: (formData.productType == 1)?true:false,  message: '请输入户型朝向' },
                    ],
                  })((<Input
                    disabled={pageType == 'detail'||formData.productType != 1 || show}
                    placeholder={'请输入户型朝向'}
                    onChange={(e) => { inputChange(e.target.value, 'orientation') }}
                  />))}
                </FormItem>
              </Col>
            }
          </Row>
        </div>
      </CollapsiblePanels>
      <CollapsiblePanels title="活动报名设置" hideUpDownBtn={true}>
      <div className={styles.radio}>
        <Row>
          <Col span={6}>
            <FormItem {...formItemLayout2}
                        label="是否需要提前报名">
                {getFieldDecorator('needEnroll ', {
                  initialValue: formData.needEnroll ,
                  rules: [
                    {  required: true,  message: '请输入报名费'},
                    {
                      validator: (rule, value, callback) => {
                        let type = 'price'
                        validator(rule, value, callback, type)
                      }
                    }
                  ],
                  // normalize: normalize
                })(
                  <Radio.Group onChange={e =>{
                    inputChange(e.target.value, 'needEnroll')
                    if(e.target.value === 2) {
                      inputChange(1, 'enrollType')
                      form.resetFields('enrollType',1)
                      inputChange('', 'securityMoney')
                      form.resetFields('securityMoney','')
                    }
                  }} >
                    <Radio value={1}>是</Radio>
                    <Radio value={2}>否</Radio>
                  </Radio.Group>
                )}          
                
            </FormItem>
          </Col>
          {/* <Col span={2}></Col>
          <Col span={16}><div style={{'height':'39px'}}>说明：<br/>1、房源类活动设置缴纳报名费用才能参加。<br/>
          2、非房产类商品可根据实际需求，设置是否要收取报名费。<br/>3、如竞拍不成功，报名费将在T+1日退回客户钱包，T+2才到账。
            </div></Col> */}
        </Row>
        {/* <Row> */}
          {/* <Col className="col" span={6}>
            <FormItem {...formItemLayout2}
                      label="报名费">
                        {getFieldDecorator('enrollType', {
                  initialValue: formData.enrollType,
                  rules: [
                    {  required: formData.needEnroll===1,  message: '请输入报名费',  message: '请输入报名费' },
                    {
                      validator: (rule, value, callback) => {
                        let type = 'price'
                        validator(rule, value, callback, type)
                      }
                    }
                  ],
                  // normalize: normalize
                })(
                  <Radio.Group 
                    disabled={formData.needEnroll==2}
                    onChange={e =>{
                      inputChange(e.target.value, 'enrollType')
                      if(formData.enrollType === 1) {
                        inputChange('', 'securityMoney')
                        form.resetFields('securityMoney',[])
                      }
                    }} >
                    <Radio value={2}>有</Radio>
                    <Radio value={1}>无</Radio>
                  </Radio.Group>
                )}
              
            </FormItem>
          </Col> */}
          {/* <Col span={2}>
                      <Tooltip title=""><Icon  type="question-circle" style={{ fontSize: '16px', color: '#08c',marginTop:'12px',marginLeft:'4px' }} /></Tooltip>
            </Col> */}
          
        {/* </Row> */}
      </div>
    </CollapsiblePanels>
      {/*秒杀价格 秒杀价  原价 应付报名费 应付定金 优惠价 平方价*/}
      <CollapsiblePanels title="秒杀价格" hideUpDownBtn={true}>
        <div className={''}>
          <Row>
            <Col className="col" span={8}>
              <FormItem {...formItemLayout}
                label="秒杀价">
                {getFieldDecorator('seckillPrice', {
                  initialValue: (formData.seckillPrice||''),
                  rules: [
                    { required: true,  message: '请输入秒杀价' },
                    {
                      validator: validator
                    }
                  ],
                  // normalize: normalize
                })(<Input
                  disabled={pageType == 'detail' || show}
                  placeholder={'请输入秒杀价'}
                  addonBefore="￥"
                  onChange={(e) => { inputChange(e.target.value, 'seckillPrice') }}
                />)}
              </FormItem>
            </Col>
            <Col className="col" span={8}>
              <FormItem {...formItemLayout}
                label="原价">
                {getFieldDecorator('originalPrice', {
                  initialValue: formData.originalPrice,
                  rules: [
                    { required: true,  message: '请输入原价' },
                    {
                      validator: (rule, value, callback) => {
                        let type = 'price'
                        validator(rule, value, callback, type)
                      }
                    }
                  ],
                  // normalize: normalize
                })(<Input
                  disabled={pageType == 'detail' || show}
                  placeholder={'请输入原价'}
                  addonBefore="￥"
                  onChange={(e) => { inputChange(e.target.value, 'originalPrice') }}
                />)}
              </FormItem>
            </Col>
            {/* <Col className="col" span={8}>
              <FormItem {...formItemLayout}
                        label="报名费">
                {getFieldDecorator('securityMoney', {
                  initialValue: formData.securityMoney,
                  rules: [
                    { required: formData.enrollType ===2 ,  message: '请输入报名费' },
                    {
                      validator: (rule, value, callback) => {
                        let type = 'price'
                        validator(rule, value, callback, type)
                      }
                    }
                  ],
                  // normalize: normalize
                })(<Input
                    disabled={pageType == 'detail' || formData.enrollType ===1 || formData.needEnroll === 2}
                    placeholder={'请输入报名费'}
                    addonBefore="￥"
                    onChange={(e) => { inputChange(e.target.value, 'securityMoney') }}
                />)}
              </FormItem>

            </Col> */}
            {/*<Col className="col" span={6}>*/}
              {/*<FormItem {...formItemLayout}*/}
                {/*label="报名费">*/}
                {/*{getFieldDecorator('securityMoney', {*/}
                  {/*initialValue: formData.securityMoney,*/}
                  {/*rules: [*/}
                    {/*{ required: !formData.freeSecurityMoney,  message: '请输入报名费' },*/}
                    {/*{*/}
                      {/*validator: (rule, value, callback) => {*/}
                        {/*let type = 'price'*/}
                        {/*validator(rule, value, callback, type)*/}
                      {/*}*/}
                    {/*}*/}
                  {/*],*/}
                  {/*// normalize: normalize*/}
                {/*})(<Input*/}
                  {/*disabled={pageType == 'detail' || formData.freeSecurityMoney}*/}
                  {/*placeholder={'请输入报名费'}*/}
                  {/*addonBefore="￥"*/}
                  {/*onChange={(e) => { inputChange(e.target.value, 'securityMoney') }}*/}
                {/*/>)}*/}
              {/*</FormItem>*/}

            {/*</Col>*/}
            {/*<Col className="col" span={6}>*/}
                {/*<FormItem {...formItemLayout}>*/}
                    {/*<Checkbox*/}
                        {/*checked={formData.freeSecurityMoney}*/}
                        {/*onChange={(e) => inputChange(e.target.checked, 'freeSecurityMoney')}*/}
                    {/*>免交报名费*/}
                    {/*</Checkbox>*/}
                {/*</FormItem>*/}

            {/*</Col>*/}

          </Row>
          <Row>
            <Col style={{paddingLeft:'100px',color:'#999'}} className="col" span={8}>秒杀价：商品类型为非房地产类的，秒杀时支付的是秒杀价，全额支付。</Col>
          </Row>
          <Row>
            {formData.productType < 4 &&
              <Col className="col" span={8}>
              <FormItem {...formItemLayout}
                        label="定金">
                  {getFieldDecorator('earnestMoney', {
                      initialValue: formData.earnestMoney,
                      rules: [
                          { required: true,  message: '请输入定金' },
                          {
                              validator: (rule, value, callback) => {
                                  let type = 'price'
                                  validator(rule, value, callback, type)
                              }
                          }
                      ],
                      // normalize: normalize
                  })(<Input
                      disabled={pageType == 'detail' || show}
                      placeholder={'请输入定金'}
                      addonBefore="￥"
                      onChange={(e) => { inputChange(e.target.value, 'earnestMoney') }}
                  />)}
              </FormItem>
          </Col>
            }
              
              {formData.productType<4?
              <Col className="col" span={8}>
                <FormItem {...formItemLayout}
                  label="优惠价">
                  {getFieldDecorator('salePrice', {
                    initialValue: (formData['salePrice']||''),
                    rules: [
                      { required: true,  message: '请输入优惠价' },
                      {
                        validator: (rule, value, callback) => {
                          let type = 'price'
                          validator(rule, value, callback, type)
                        }
                      }
                    ],
                    // normalize: normalize
                  })(<Input
                    disabled={pageType == 'detail' || show}
                    placeholder={'请输入优惠价'}
                    addonAfter="元/㎡"
                    addonBefore="￥"
                    onChange={(e) => { inputChange(e.target.value, 'salePrice') }}
                  />)}
                </FormItem>
              </Col>
               :null
              } 
            
            {formData.productType <4 &&
              <Col className="col" span={8}>
              <FormItem {...formItemLayout}
                label="平方价">
                {getFieldDecorator('squarePrice', {
                  initialValue: formData.squarePrice,
                  rules: [
                    { required: true,  message: '请输入平方价' },
                    {
                      validator: (rule, value, callback) => {
                        let type = 'price'
                        validator(rule, value, callback, type)
                      }
                    }
                  ],
                  // normalize: normalize
                })(<Input
                  disabled={pageType == 'detail' || show}
                  placeholder={'请输入平方价'}
                  addonAfter="元/㎡"
                  addonBefore="￥"
                  onChange={(e) => { inputChange(e.target.value, 'squarePrice') }}
                />)}
              </FormItem>
            </Col>}
          </Row>
          <Row>
            <Col style={{paddingLeft:'100px',color:'#999'}} className="col" span={8}>定金：商品类型为房地产类的，秒杀时支付的是定金，差额需要到项目现场补款。</Col>
          </Row>
          <Row>
            {/* <Col className="col" span={8}>
              <FormItem {...formItemLayout1}
                          label="支付方式">
                  {getFieldDecorator('payWay', {
                    initialValue: formData.payWay,
                    rules: [
                      { required: true,  message: '请选择支付方式' },
                    ],
                  })((<Select disabled={pageType == 'detail' || show } placeholder="请选择"
                              onChange={(val) => inputChange(val, 'payWay')}>
                        <Select.Option  value={'WECHATPAY'}>微信支付</Select.Option>
                        <Select.Option  value={'LLPAY'}>智美钱包支付</Select.Option>
                    </Select>))}
                </FormItem>
            </Col>
            <Col className="col" span={8}>
              <FormItem {...formItemLayout1}
                          label="商户号">
                  {getFieldDecorator('merchantCode', {
                    initialValue: formData.merchantCode,
                    rules: [
                      { required: true,  message: '请选择支付方式' },
                    ],
                  })((<Select disabled={pageType == 'detail' || show } placeholder="请选择"
                              onChange={(val) => inputChange(val, 'merchantCode')}>
                        <Select.Option  value={'1494425361'}>商户1</Select.Option>
                        <Select.Option  value={'1494425362'}>商户2</Select.Option>
                    </Select>))}
                </FormItem>
            </Col> */}

            <Col span={8}>
									<FormItem label='支付商户号'  {...formItemLayout}>

                      {getFieldDecorator('merchantCode', {
                        initialValue: formData.merchantCode,
                        rules: [
                          {
                            required: true, message: '请选择支付商户号'
                          },
                        ],
                      })(
                        <Select 
                            // disabled={formData.receiptFlag=='0'}
                            onChange={(val) => inputChange(val, 'merchantCode')} placeholder="请选择支付商户号">
                          
                            {payCodeList && payCodeList.map((item, i) => {
                                return (
                                    <Select.Option value={item.merchantCode}>{item.merchantName}</Select.Option>
                                )
                            })}
                        </Select>
                      )}
									</FormItem>
								</Col>
            <Col className="col" span={8}>
              <FormItem {...formItemLayout2}
                        // extra="设置规定时间内支付"
                        label="设置规定时间内支付">
                {getFieldDecorator('waitPayTime', {
                  initialValue: formData.waitPayTime,
                  rules: [
                    { required: true,  message: '请输入时间'},
                    {validator: (rule, value, callback) => {
                      ((value || value + '' === '0') && ('' + value).search(/^(0|[1-9]\d{0,9})$/)) ? callback('限制为10位以内的整数') : callback();
                    }}
                  ],
                })(<Input
                    placeholder={'请输入时间'}
                    addonAfter="分钟"
                    onChange={(e) => { inputChange(e.target.value, 'waitPayTime') }}
                />)}
              </FormItem>
            </Col>
          </Row>
          <Row>
            <Col className="col" span={9}></Col>
            <Col style={{paddingLeft:'100px',color:'#999'}} className="col" span={8}>抢购时间转支付时间</Col>
          </Row>
        </div>
      </CollapsiblePanels>
      <CollapsiblePanels title="商品图" hideUpDownBtn={true}>
        <Row>
          <FormItem {...imageLayout} label="商品图">
            <Uploader uploadedUrls={imageUrls || formData.medias[0].fileUrl}
              removeFileCbf={(index) => { removeImgUrl(index) }}
              uploadSuccessCbf={(imgUrl) => { updateImageModel(imgUrl) }}
              showType='6'
              fileType='image'
              fileMaxSize='0.5'
              minCropBoxWidth={1500}
              minCropBoxHeight={1120}
              maxFiles='10' />

          </FormItem>

          <Col span={12}>
            <span style={{ color: '#999', marginLeft: '4%' }}>
            图片分辨率需为1500px*1120px，且文件大小在500kb以下，支持jpg，png格式。
              </span>
          </Col>
        </Row>
      </CollapsiblePanels>
      {formData.productType >3 &&
        
      <CollapsiblePanels title="商品介绍" hideUpDownBtn={true}>
        <FormItem>
          <Ueditor  id="productDetail1"
          style={{ width: '100%', height: '400px'}}
          editable={!show}
          html={formData.productDesc || ''}
          startDate=''
          endDate=''
          inputChange={
            (e) => { 
              inputChange(e, 'productDesc')
          }}
          />
        </FormItem>
      </CollapsiblePanels>
      }
      <CollapsiblePanels title="添加秒杀标签" hideUpDownBtn={true}>
        <Row>
          <Col span={12}>
            <FormItem {...tagLayout}
              label="秒杀标签">
              {getFieldDecorator('tags', {
                initialValue: formData.tags || [],
                rules: [
                  { required: false,  message: '请输入秒杀标签' },
                ],
              })(<Select
                disabled={pageType == 'detail' ||show}
                mode="multiple"
                size='default'
                notFoundContent='没有此标签'
                placeholder="请选择标签"
                onChange={(e, v) => {
                  let arr = []
                  v.map((item, idx) => {
                    arr.push(item.props.children)
                  })
                  inputChange(arr, 'tags')
                }}
                style={{ width: '100%' }}
              >
                {tagsList && tagsList.map((item, idx) => {
                  return (
                    item?
                    <Select.Option key={idx+''} value={item.name}>{item.name}</Select.Option>:null
                  )
                })}
              </Select>)}
            </FormItem>
          </Col>
        </Row>
      </CollapsiblePanels>
      <CollapsiblePanels title="添加联系方式" hideUpDownBtn={true}>
        <Row>
          <Col className="col" span={8}>
            <FormItem {...formItemLayout}
              label="姓名">
              {getFieldDecorator('realtyConsultant', {
                initialValue: formData.realtyConsultant,
                rules: [
                  { required: formData.productType>3?false:true,  message: '请输入姓名' },
                ],
              })(<Input
                placeholder={'客户领取商品时联系人姓名'}
                disabled={show}
                onChange={(e) => { inputChange(e.target.value, 'realtyConsultant') }}
              />)}
            </FormItem>
          </Col>
          <Col className="col" span={8}>
            <FormItem {...formItemLayout}
                      label="电话">
              {getFieldDecorator('consultantMobile', {
                initialValue: formData.consultantMobile,
                rules: [
                  { required: formData.productType>3?false:true,  message: '请输入正确的手机号', pattern: /^1[3456789]\d{9}$/ },
                ],
              })(<Input
                placeholder={'请输入手机号'}
                disabled={show}
                onChange={(e) => { inputChange(e.target.value, 'consultantMobile') }}
              />)}
            </FormItem>
          </Col>
        </Row>
      </CollapsiblePanels>
      {/*选择项目弹窗*/}
      <Modal
      title={'所属项目'}
      width='1000px'
      // className="pubBiz_CommonModel"
      visible={modalObj['project'].visible}
      onCancel={() => { updateModal('project') }}
      onOk={() => { confirm() }}
      destroyOnClose={true}

    >
      <div className={''}>
        <Row>
          <ListPage pageProps={pageProps2}/>
        </Row>
      </div>
    </Modal>
      {/*选择商品列表弹窗*/}
      <Modal
          title={'商品列表'}
          width='1000px'
          visible={modalObj['productList'].visible}
          onCancel={() => { updateModal('productList') }}
          footer={null}

      >
        <div className={''}>
          <ListPage pageProps={pageProps} />
        </div>
      </Modal>
       <Modal
       title={'选择账户'}
       width='1100px'
       zIndex={10000000}
       visible={modalObj['accountList'].visible}
       onCancel={() => { updateModal('accountList') }}
       footer={null}
      
     >
       <div className={''}>
         <Row>
           <div style={{width:'300px',position:'relative',left:'84%'}}>
             <Button type='primary' onClick={
               ()=>{
                hashHistory.push({
                  pathname: '/home/accountAdmin/accountDetail',
                  query: {actionType: 'add', }
                })
                modalObj.accountList.visible=false
                dispatch({
                  type:`${namespace}/updateStore`,
                  payload:{
                    modalObj
                  }
                })

               }
             }>新建账户
            
              </Button>
              <span style={{marginLeft:'15px'}}>
                <Button type='primary' onClick={()=>{confirm1()}
                }>确认</Button>
              </span>
             
             
           </div>
         </Row>
         <Row>
           <ListPage pageProps={pageProps3}/>
         </Row>
       </div>
     </Modal>
      <Modal
          title={'商品列表'}
          width='1100px'
          // className="pubBiz_CommonModel"
          visible={modalObj['productList1'].visible}
          onCancel={() => { updateModal('productList1') }}
          // onOk={() => { updateModal() }}
          // onOk={}
          footer={null}

      >
        <div className={''}>
          <ListPage pageProps={pageProps1} />
        </div>
      </Modal>
    </div>
  )
}

// 连接视图(view)和模型(model)
export default connect(mapStateToProps)(Form.create()(routeView))

